//
//  UIViewController+Helper.m
//  Kaagad Peso
//
//  Created by ZhengChengFeng on 2024/10/15.
//

#import "UIViewController+Helper.h"

@implementation UIViewController (Helper)

- (id)jumpToPopControlClass:(NSString *)controllerName{
    for (int i = 0; i < self.navigationController.viewControllers.count; i++) {
        UIViewController *vc = self.navigationController.viewControllers[i];
        if ([vc isKindOfClass:[NSClassFromString(controllerName) class]]) {
            [self.navigationController popToViewController:vc animated:true];
            return vc;
        }
    }
    return nil;
}


- (VoidBlock)finishBlock {
    return objc_getAssociatedObject(self, @selector(finishBlock));
}

- (void)setFinishBlock:(VoidBlock)aFinishBlock{
    objc_setAssociatedObject(self, @selector(finishBlock), aFinishBlock, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}



@end
